﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using com.nm.ApiServer;
using com.nm.db.Models.Terminal;
using com.nm.library;

namespace TerminalAPI
{
    /// <summary>
    /// 店铺货架数量变更日志
    /// </summary>
    public static class SysChangeLog
    {
        public static void WriteLog(int userId, int type,string code, string context,string memo)
        {
            //var Id =  UserInfo.UserID==""?0:Convert.ToInt16(UserInfo.UserID);
            var dc = new TerminalEntities();
            var log = new Sys_ChangeLog
            {
                Context = context,
                Memo = memo,
                Operator = userId,
                OperatorDate = DateTime.Now,
                Code= code,
                Type=type
            };
            dc.Sys_ChangeLog.Add(log);
            try
            {
                dc.SaveChanges();
            }
            catch
            {
                throw;
            }
        }
    }

    public enum LogType
    {
        /// <summary>
        /// 货架数量变更
        /// </summary>
        ShelfNum=1,

        /// <summary>
        /// 陈列信息
        /// </summary>
        DisplayInfo=2,

        /// <summary>
        /// 陈列明细
        /// </summary>
        DisplayDetail = 3
    }
}
